package com.fsl.springbootapollo.conf;

import com.fsl.springbootapollo.util.DataSourceManager;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;

@Configuration
public class RefreshableDataSourceConfiguration {

    @Bean
    public DynamicDataSource dataSource(DataSourceManager dataSourceManager) {
        DataSource actualDataSource = dataSourceManager.createDataSource();
        return new DynamicDataSource(actualDataSource);
    }
}
